package com.lxlg.lxlg_order.app.controller;


import com.lxlg.core.utils.Result;
import com.lxlg.lxlg_order.client.StatementClient;
import com.lxlg.lxlg_order.client.param.MonthStatementInfo;
import com.lxlg.lxlg_order.client.param.SearchDayStatementFOrm;
import com.lxlg.lxlg_order.client.result.StatementsInfo;
import com.lxlg.lxlg_order.client.result.YearStatementInfo;
import com.lxlg.lxlg_order.infra.model.MonthStatement;
import com.lxlg.lxlg_order.infra.model.YearStatement;
import com.lxlg.lxlg_order.service.service.DayStatementService;
import com.lxlg.lxlg_order.service.service.MonthStatementService;
import com.lxlg.lxlg_order.service.service.YearStatementService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author kevin
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/infra/day-statement")
public class StatementController implements StatementClient {
    @Resource
    private DayStatementService dayStatementService;
    @Resource
    private MonthStatementService monthStatementService;
    @Resource
    private YearStatementService yearStatementService;

    @Override
    @PostMapping("getDayStatement")
    @ApiOperation("查看日报表")
    public Result<List<StatementsInfo>> getDayStatement(@Valid SearchDayStatementFOrm searchDayStatementFOrm) {
        return  dayStatementService.queryDayStatement(searchDayStatementFOrm);

    }
    @PostMapping("getMonthStatement")
    @Override
    @ApiOperation("查看月表")
    public Result<List<MonthStatementInfo>> getMonthStatement(@Valid SearchDayStatementFOrm searchDayStatementFOrm) {
        return  monthStatementService.queryMonthStatement(searchDayStatementFOrm);

    }


    @PostMapping("getYearStatement")
    @Override
    @ApiOperation("查看年报表")
    public Result<List<YearStatementInfo>> getYearStatement(@Valid SearchDayStatementFOrm searchDayStatementFOrm) {
        return  yearStatementService.queryYearStatement(searchDayStatementFOrm);

    }
}

